﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaEngine.Graphics;

using Microsoft.Xna.Framework;


namespace FXnaEngine.Components
{

    /// <summary>
    /// 为所有需要渲染的组件提供基类支持
    /// </summary>
   public abstract class FRendererComponent:FComponent
    {

       public FRendererComponent(FEntity parent)
           : base(parent)
   {



          



   }



       #region 属性


       bool _enabled = true;


       /// <summary>
       /// 可见性控制
       /// </summary>
       public bool Enabled
       {
           get { return _enabled; }
           set { _enabled = value; }
       }





       bool castShadows = false;

        public bool CastShadows
        {
            get { return castShadows; }
            set { castShadows = value; }
        }


        bool receiveShadows = false;

        public bool ReceiveShadows
        {
            get { return receiveShadows; }
            set { receiveShadows = value; }
        }


        protected FMaterial material=new FMaterial ();

        public FMaterial Material
        {
            get { return material; }
            set { material = value; }
        }



        BoundingSphere boundingSphere;

        public BoundingSphere BoundingSphere
        {
            get { return boundingSphere; }
            set { boundingSphere = value; }
        }



       #endregion


        #region 方法

       /// <summary>
       /// 对外渲染的主函数
       /// </summary>
       /// <param name="graphics"></param>
        public  void Render(FGraphicsSystem graphics)
        {

            if (!this._enabled)
            {
                return;
                
            }

            this.RenderCore(graphics);

 
        }


       /// <summary>
       /// 独立的渲染核心
       /// </summary>
       /// <param name="graphics"></param>
        protected virtual void RenderCore(FGraphicsSystem graphics)
        {

 
        }




        #endregion





    }
}
